package 集合.Comparable.Test02;

import java.util.TreeMap;
import java.util.TreeSet;

public class ComparableTest02 {
    public static void main(String[] args) {
        /*
        TreeMap<Integer,Dog> dogs = new TreeMap(new DogComparator());
        Dog dog1 = new Dog(3);
        Dog dog2 = new Dog(1);
        dogs.put(1,dog1);
        System.out.println(dogs.put(1,dog2));
        */

        TreeSet<Dog> dog = new TreeSet(new DogComparator());
        dog.add(new Dog(1));
        dog.add(new Dog(5));
        dog.add(new Dog(8));
        dog.add(new Dog(9));
        for (Dog d : dog){
            System.out.println(d);
        }
    }
}
